//
//  ExpandInfo.h
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 16/12/9.
//  Copyright © 2016年 com.xtion.crm. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol ExpandInfoFieldDelegate <NSObject>

@property(nonatomic,strong) NSMutableDictionary *expandfields;

@end

typedef NS_ENUM(NSUInteger,DynamicFieldControlType)
{
    /*
     1文本
     2单选框
     3多选框
     4大文本
     5整数
     6小数
     7日期(date)
     8日期+时间(datetime)
     9地图选择
     10头像
     11图片
     */
    DynamicFieldControlTypeNone,
    DynamicFieldControlTypeText = 1,
    DynamicFieldControlTypeBigText = 4,
    DynamicFieldControlTypeSingleSelect = 2,
    DynamicFieldControlTypeMultiSelect = 3,
    DynamicFieldControlTypeInt = 5,
    DynamicFieldControlTypeDecimal = 6,
    DynamicFieldControlTypeDate = 7,
    DynamicFieldControlTypeDateTime = 8,
    DynamicFieldControlTypePosition = 9,
    DynamicFieldControlTypeHeadImage = 10,
    DynamicFieldControlTypeImagePanel = 11,
    
    //TODO
    //12语音
    //13录音
    //14小视频
    //15录像
    //16语音，录音小视频，录像面板
    DynamicFieldControlTypeVoice = 12,
    DynamicFieldControlTypeRecordVoice = 13,
    DynamicFieldControlTypeSmallRecordVideo = 14,
    DynamicFieldControlTypeRecordVideo = 15,
    DynamicFieldControlTypeMixedPanel = 16,
    
    //hidden
    DynamicFieldControlTypeHidden = 17,

    //SelectDept, SelectUser
    DynamicFieldControlTypeSelectDept = 18,
    DynamicFieldControlTypeSelectUser = 19,
    
    DynamicFieldControlTypeCheckBox = 20,
    DynamicFieldControlTypeSingleSelectDic = 21,
    
    //系统字段控件
    DynamicFieldControlTypeCreateUUID = 100,
    DynamicFieldControlTypeCreateUserID = 101,
    DynamicFieldControlTypeCreateUserName = 102,
    DynamicFieldControlTypeCreateDeptID = 103,
    DynamicFieldControlTypeCreateDeptName = 104,
    DynamicFieldControlTypeCreateDate = 105,
    
    //static
    DynamicFieldControlTypeStaticText = 1001,
    DynamicFieldControlTypeTextSingleSelect = 1002,
    DynamicFieldControlTypeMultiSelectStaticText = 1003,
    DynamicFieldControlTypeDateTimeStaticText = 1004,
    DynamicFieldControlTypePositionStaticText = 1005,
    DynamicFieldControlTypeStaticImagePanel = 1006,
    
    DynamicFieldControlTypeSwitchSelect = 1007,
    
    DynamicFieldControlTypeCreateUUIDStaticText = 1008,
    DynamicFieldControlTypeCreateUserIDStaticText = 1009,
    DynamicFieldControlTypeCreateUserNameStaticText = 1010,
    DynamicFieldControlTypeCreateDeptIDStaticText = 1011,
    DynamicFieldControlTypeCreateDeptNameStaticText = 1012,
    DynamicFieldControlTypeCreateDateStaticText = 1013,
    
    DynamicFieldControlTypeStaticSingleSelectDic = 1014,
};

//系统字段fieldname
#define SysField_ID @"ID"
#define SysField_CreateUserID @"CreateUserID"
#define SysField_CreateUserName @"CreateUserName"
#define SysField_CreateDeptID @"CreateDeptID"
#define SysField_CreateDeptName @"CreateDeptName"
#define SysField_CreateDate @"CreateDate"

//controlname
#define Control_Hidden @"Hidden"
#define Control_DatePicker @"DatePicker"
#define Control_TextBox @"TextBox"
#define Control_TextArea @"TextArea"
#define Control_DropDownList @"DropDownList"
#define Control_DropDownListFix @"DropDownListFix"
#define Control_CheckBox @"CheckBox"
#define Control_Numeric @"Numeric"
#define Control_SelectDept @"SelectDept"
#define Control_SelectUser @"SelectUser"
#define Control_Attachment @"Attachment"
#define Control_ZiDianBiaoDropDownList @"ZiDianBiaoDropDownList"
#define Control_SelectDept @"SelectDept"

//attachment
#define Field_Attachment @"attachment"

//decimal
#define DBType_Decimal @"decimal"

//
#define Dictionary_TypeId @"typeid"


@interface FieldDescript : NSObject<NSCoding>

@property(nonatomic,strong) XMSNumberInt *controlType;
@property(nonatomic,strong) NSString *entityRegID;
@property(nonatomic,strong) NSString *expandFieldID;
@property(nonatomic,strong) NSString *fieldLabel;
@property(nonatomic,strong) XMSNumberInt *fieldLength;
@property(nonatomic,strong) NSString *fieldName;
@property(nonatomic,strong) XMSNumberInt *fieldType;//0系统，1默认，2自定义
@property(nonatomic,strong) XMSNumberInt *isAllowEmpty;
@property(nonatomic,strong) XMSNumberInt *isReadOnly;
@property(nonatomic,strong) NSString *lineName;
@property(nonatomic,strong) NSString *optional;//当下拉时，下拉选择内容
@property(nonatomic,strong) XMSNumberInt *optIsVisible;
@property(nonatomic,strong) XMSNumberInt *order;
@property(nonatomic,strong) NSString *regx;
@property(nonatomic,strong) XMSNumberInt *status;
@property(nonatomic,strong) XMSNumberInt *viewIsVisible;

@property(nonatomic,strong) XMSNumberInt *searchIsVisible;

@property(nonatomic,assign) NSInteger titleAlignment;
@property(nonatomic,readonly) NSArray *optionals; //对应于optional的分割项
@property(nonatomic,assign) DynamicFieldControlType capacity; //控件的能力，默认情况下，controlType == 0，即默认，但能强制修改，比如让文本框在取值组装地址数据

@property(nonatomic,strong) NSMutableDictionary *param;//扩展参数
@end

typedef NS_ENUM(NSUInteger,DynamicFieldType)
{
    //什么都不能修改
    DynamicFieldTypeSystem = 0,
    //可以修改是否必填，是否显示
    DynamicFieldTypeDefault,
    
    DynamicFieldTypeCustom
};

@interface ExpandInfo : NSObject

@property(nonatomic,strong) NSString *key;
@property(nonatomic,strong) NSString *name;
@property(nonatomic,strong) NSString *tableName;
@property(nonatomic,strong) NSString *timespan;
@property(nonatomic,strong) NSArray *fieldDescript;

@end

@interface SingleSelectInfo : NSObject

@property(nonatomic,strong) id key;     //保存的值
@property(nonatomic,strong) id value;   //显示的值

@end
